#include "Th.hpp"
#include <iostream>
namespace qing {
    // 监听线程
    class LTh: public qing::Th {
    public:
        LTh() {

            this->WakeEvent = [this] {
                std::cout << "我被唤醒了。" << std::endl;
                this->run();
            };

            this->LoopEvent = [] {
                std::cout << "我正在运行..." << std::endl;
                std::this_thread::sleep_for(std::chrono::milliseconds(100));
            };

            this->ClearEvent = [] {
                std::cout << "清理资源。" << std::endl;
            };
        }

        ~LTh() {
            std::cout << "析构函数" <<std::endl;
            this->shut();
            this->waitClose();
        }
    };
}


int main() {
    {
        qing::LTh th;
        th.Act();
        th.waitStart();
    }

    while(1);
}